// 根据屏幕分辨率初始化html的fontsize值
// 元素rem计算方式：元素宽高 / 设计稿宽度 * 320(默认宽度) / 20(默认font-size值)
(function (doc, win) {
	var docEl = doc.documentElement,
		resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		recalc = function () {
			var clientWidth = docEl.clientWidth;
			if (!clientWidth) return;
			docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
		};
	if (!doc.addEventListener) return;
	win.addEventListener(resizeEvt, recalc, false);
	doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);

function comajax(url,data, fn, err) {

    $.ajax({
        url: url,
        type: 'post',
        dataType:'jsonp',
		contentType: 'application/json',
        data: data,
		jsonp:'callback',
        cache: false,
        success: function (d) {
			alert(d);
			eval("("+d+")")
            fn(d);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            if (typeof (err) == 'function') {
                err();
            }
        }
    });
}
function queryStringbyrul(url,name) {
    var result = url.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
    if (result == null || result.length < 1) { return ""; }
    return result[1];
}
function queryString(name) {
    var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
    if (result == null || result.length < 1) { return ""; }
    return result[1];
}
